package com.kuaidao.sys.test;


import com.hp.hpl.sparta.ParseLog;
import com.kuaidao.sys.dto.dictionary.DictionaryAddUpdateDTO;
import com.kuaidao.sys.dto.dictionary.DictionaryReqDTO;
import com.kuaidao.sys.dto.dictionary.DictionaryResDTO;
import com.kuaidao.sys.entity.user.Dictionary;
import com.kuaidao.sys.mapper.user.DictionaryMapper;
import com.kuaidao.sys.service.dictiondry.IDictiondryService;
import com.kuaidao.sys.util.IdUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;
import java.util.List;


@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class DictiondryService {



    @Autowired
    private IDictiondryService iDictiondryService;

    @Autowired
    private DictionaryMapper dictionaryMapper;

    @Test
    public void testInsertDic(){
        Dictionary dictionary = new Dictionary();
        dictionary.setName("test");
        dictionary.setId(IdUtil.getUUID());
        dictionary.setCreateTime(new Date());
        iDictiondryService.insertDictiondrt(dictionary);
    }

    @Test
    public void testFindByPage(){
        DictionaryReqDTO dictionaryReqDTO = new DictionaryReqDTO();
        dictionaryReqDTO.setName("1111");
        dictionaryMapper.findDictiondryByPage(dictionaryReqDTO);

    }


    @Test
    public void testFindById(){
        DictionaryReqDTO dictionaryReqDTO =new DictionaryReqDTO();
        DictionaryResDTO byPrimaryKey = iDictiondryService.findByDictionary(1641056285556445184L);
    }


    @Test
    public void testUpdate(){
       DictionaryAddUpdateDTO dictionaryAddUpdateDTO= new DictionaryAddUpdateDTO();
        dictionaryAddUpdateDTO.setId(1641106923245953024L);
        dictionaryAddUpdateDTO.setName("E1");
        dictionaryAddUpdateDTO.setDescription("EEE");
        dictionaryAddUpdateDTO.setCode("as444");
        dictionaryAddUpdateDTO.setUpdateTime(new Date());
        iDictiondryService.updateDictionary(dictionaryAddUpdateDTO);
    }

    @Test
    public void testDelect(){
        Dictionary dictionary = new Dictionary();
        dictionary.setId(1641106923245953024L);
        iDictiondryService.deleteByDictiontry(dictionary.getId());
    }



}
